import platform
import json
from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.


if platform.system().lower() == 'linux':
    from .models import ControlCar


def cal(request):
    num1 = request.POST.get("num1")
    num2 = request.POST.get("num2")
    print('#########################################################################', num1)
    num1 = json.loads(num1)
    x, y = float(num1['x']), float(num1['y'])
    if platform.system().lower() == 'linux':
        ControlCar.control_car(x, y)
    return HttpResponse('ok')


def control(request):
    return render(request, "control.html", {})
